home *** CD-ROM | disk | FTP | other *** search
- property state, channel, loopLength, baseCastPos, castOffset, clicked, commandString, clickSound, ROsound
- global gRollAnimButton, gLoopButton
-
- on birth me, frames, channelNum, command, soundA, soundB
- set state to #idle
- set loopLength to frames
- set channel to channelNum
- set baseCastPos to the castNum of sprite channel
- set commandString to command
- set castOffset to 0
- set clicked to 0
- set clickSound to soundA
- set ROsound to soundB
- puppetSprite(channel, 1)
- preLoadCast(baseCastPos, baseCastPos + loopLength - 1)
- return me
- end
-
- on activate me
- if not objectp(gRollAnimButton) then
- set state to #ROsoundOn
- set gLoopButton to me
- puppetSound(ROsound)
- changeBitmap(me)
- end if
- end
-
- on process me
- if state = #ROsoundOn then
- if not soundBusy(1) then
- puppetSound(0)
- if clicked = 1 then
- puppetSound(clickSound)
- set state to #clickSoundOn
- else
- set state to #ROsoundDone
- end if
- end if
- changeBitmap(me)
- else
- if state = #ROsoundDone then
- if clicked = 1 then
- puppetSound(clickSound)
- set state to #clickSoundOn
- else
- if rollOver(channel) then
- changeBitmap(me)
- else
- set state to #idle
- set gLoopButton to EMPTY
- showAllActors()
- end if
- end if
- else
- if not soundBusy(1) then
- set clicked to 0
- set gLoopButton to EMPTY
- do(commandString)
- else
- changeBitmap(me)
- end if
- end if
- end if
- end
-
- on click me
- if (channel = the clickOn) and (clicked = 0) then
- set clicked to 1
- end if
- end
-
- on changeBitmap me
- set the castNum of sprite channel to baseCastPos + castOffset
- set castOffset to castOffset + 1
- if castOffset = loopLength then
- set castOffset to 0
- end if
- end
-